package com.buildings.bean;

import android.annotation.SuppressLint;
import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

//文件的类
@SuppressLint("ParcelCreator")
public class FileTraversal implements Parcelable {
    public String filename;// 所属图片的文件名称
    public List<String> filecontent = new ArrayList<String>();

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(filename);
        dest.writeList(filecontent);
    }

    public static final Creator<FileTraversal> CREATOR = new Creator<FileTraversal>() {

        @Override
        public FileTraversal[] newArray(int size) {
            return null;
        }

        @Override
        public FileTraversal createFromParcel(Parcel source) {
            FileTraversal ft = new FileTraversal();
            ft.filename = source.readString();
            ft.filecontent = source.readArrayList(FileTraversal.class
                    .getClassLoader());

            return ft;
        }

    };

    @Override
    public boolean equals(Object o) {
        if (o instanceof FileTraversal) {
            // 对比同类对象,文件夹名称一样即视为相等
            FileTraversal ft = (com.buildings.bean.FileTraversal) o;
            return this.filename.equals(ft.filename);
        }
        return super.equals(o);
    }

}
